﻿/* 2012/4/17 */
using System;
using System.Collections.Generic;

namespace Cosmos.Windows.Forms.FileList
{
    /// <summary>
    /// Defines methods and properties for all file list controls.
    /// </summary>
    public interface IFileList
    {
        /// <summary>
        /// Selects the previous path.
        /// </summary>
        void SelectPrevious();

        /// <summary>
        /// Selects the next path.
        /// </summary>
        void SelectNext();

        void SelectNone();

        void SelectAll();

        void SelectInvert();

        int GetSelectedIndex();

        int[] GetSelectedIndices();

        string GetSelectedPath();

        string[] GetSelectedPaths();

        void SetSelectedIndex(int index);

        void SetSelectedIndices(int[] indices);

        void SetSelectedPath(string path);

        void SetSelectedPaths(string[] paths);

        string GetPathAt(int index);

        /// <summary>
        /// Returns the zero-based index of the first occurrence of a path in the FileList.
        /// </summary>
        /// <param name="path">The path to locate in the FileList.</param>
        /// <returns>The zero-based index of the first occurrence of path within the entire FileList, if found; otherwise, –1. </returns>
        int IndexOf(string path);

        /// <summary>
        /// Determines whether a FileList contains a path.
        /// </summary>
        /// <param name="path">The path to locate in the FileList.</param>
        /// <returns>true if the FileList contains the specified path; otherwise, false.</returns>
        bool Contains(string path);

        /// <summary>
        /// Removes all paths from the FileList.
        /// </summary>
        void Clear();

        /// <summary>
        /// Adds a path into the end of  FileList.
        /// </summary>
        /// <param name="path">The path to be added.</param>
        /// <returns>The index of the added path, or -1 if the path has been contained in the FileList.</returns>
        int Add(string path);

        /// <summary>
        /// Adds the paths of the specified collection to the end of the FileList.
        /// </summary>
        /// <param name="paths">The collection whose elements should be added.</param>
        void AddRange(IEnumerable<string> paths);

        /// <summary>
        /// Inserts a path into FileList at the specified index.
        /// </summary>
        /// <param name="index">The zero-based index at which path should be inserted.</param>
        /// <param name="path">The path to be inserted.</param>
        /// <returns>The index of the inserted path, or -1 if the path has been contained in the FileList.</returns>
        int Insert(int index, string path);

        /// <summary>
        /// Removes the specified path from the FileList.
        /// </summary>
        /// <param name="path">The path to be removed.</param>
        /// <returns>The index of the removed path, or -1 if the path has not been contained in the FileList.</returns>
        int Remove(string path);

        /// <summary>
        /// Removes the path at the specified index.
        /// </summary>
        /// <param name="index">The zero-based index of the path to be removed.</param>
        /// <returns>The index of the removed path, or -1 if the index is unavailable.</returns>
        int RemoveAt(int index);

        /// <summary>
        /// Renames the specified path to a new path.
        /// </summary>
        /// <param name="srcPath">The path to be renamed.</param>
        /// <param name="dstPath">The path to rename to.</param>
        /// <returns>The index of the renamed path, or -1 if the specified path has not been contained in the FileList.</returns>
        int Rename(string srcPath, string dstPath);

        /// <summary>
        /// Ensures that the specified path is visible.
        /// </summary>
        /// <param name="index">The zero-based index of the path.</param>
        void EnsureVisible(int index);

        /// <summary>
        /// Ensure that the specified path is visible.
        /// </summary>
        /// <param name="path">The path which should be visible.</param>
        void EnsureVisible(string path);

        /// <summary>
        /// Returns the number of paths in the FileList.
        /// </summary>
        int Count 
        {
            get;
        }

        /// <summary>
        /// Returns all the paths in the FileList.
        /// </summary>
        string[] Paths
        {
            get;
        }

        /// <summary>
        /// Gets or sets the index of selected path.
        /// </summary>
        /// <remarks>Only the index set by this property will be selected.</remarks>
        int SelectedIndex
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the indices of selected paths.
        /// </summary>
        /// <remarks>Only the indices set by this property will be selected.</remarks>
        int[] SelectedIndices
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the selected path.
        /// </summary>
        /// <remarks>Only the path set by this property will be selected.</remarks>
        string SelectedPath
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the selected paths.
        /// </summary>
        /// <remarks>Only the paths set by this property will be selected.</remarks>
        string[] SelectedPaths
        {
            get;
            set;
        }

        /// <summary>
        /// Gets the path in specified index.
        /// </summary>
        /// <param name="index">The zero-based index of the path to get.</param>
        /// <returns>The path.</returns>
        string this[int index]
        {
            get;
        }

        /// <summary>
        /// Occurs when selected paths has been changed.
        /// </summary>
        event EventHandler SelectedChanged;

        /// <summary>
        /// Occurs when the paths has been cleared.
        /// </summary>
        event EventHandler PathCleared;

        /// <summary>
        /// Occurs when a path has been added.
        /// </summary>
        event PathEventHandler PathAdded;

        /// <summary>
        /// Occurs when a collection of paths have been added.
        /// </summary>
        event PathsEventHandler PathsAdded;

        /// <summary>
        /// Occurs when a path has been inserted.
        /// </summary>
        event PathInsertedEventHandler PathInserted;

        /// <summary>
        /// Occurs when a path has been removed.
        /// </summary>
        event PathEventHandler PathRemoved;

        /// <summary>
        /// Occurs when a index of path has been removed.
        /// </summary>
        event IndexEventHandler IndexRemoved;

        /// <summary>
        /// Occurs when a path has been renamed.
        /// </summary>
        event RenamedEventHandler Renamed;
    }
}
